﻿using System.ComponentModel.DataAnnotations;
using System.Xml.Linq;

namespace cart.Models
{
    public class Cart
    {
        public int Id { get; set; } //购物车id

        [Required(ErrorMessage ="商品名称必填")]
        [Display(Name = "商品名称")]
        [StringLength(20,MinimumLength =1,ErrorMessage ="1-20个字符之间")]
        public String? ProductTitle { get; set; } //商品id


        [Required(ErrorMessage = "商品数量必填")]
        [Display(Name ="商品数量")]
        [Range(0,9999,ErrorMessage ="0-9999之间")]
        public int ProductNum { get; set; }//商品数量


        [Required(ErrorMessage = "创建时间必填")]
        [Display(Name ="创建时间")]
        [DataType(DataType.Date)]
        public DateTime CreatTime { get; set; }//创建时间


        [Required(ErrorMessage = "用户名称必填")]
        [Display(Name ="用户名称")]
        [StringLength(20, MinimumLength = 1, ErrorMessage = "1-20个字符之间")]
        public String? UserId { get; set; }


        [Required(ErrorMessage = "商品价格必填")]
        [Display(Name = "商品价格")]
        [DataType(DataType.Currency)]
        public decimal Price { get; set; } //商品价格
    }
}
